<template>
  <div class="search-album">
    <div class="item"
         v-for="(item,index) in albums"
         :key="index"
         @click="enteralbum(index)">
      <div class="left">
        <img :src="item.picUrl"
             alt="">
      </div>
      <div class="right">
        <p class="name">{{item.name}}</p>
        <p class="time"></p>
      </div>
    </div>
  </div>
</template>

<script>
import { _Search } from 'network/search'
import moment from 'moment'
export default {
  name: 'SearchAblum',
  data () {
    return {
      searchType: 10,
      albums: [], // 存放专辑列表
    };
  },
  created () {
    this.Search();
  },
  methods: {
    Search () {
      this.keywords = this.$route.params.key;
      _Search(this.keywords, this.searchType).then((res) => {
        this.albums = res.data.result.albums;
        console.log(res);
      });
    },
    enteralbum (index) {
      this.$router.push('/album/' + this.albums[index].id)
    }
  }
}
</script>

<style scoped>
.search-album {
  width: 100%;
  height: 100%;
  font-size: 14px;
  color: #333;
}
.search-album .item {
  width: 100%;
  height: 70px;
  display: flex;
}
.item .left {
  width: 6%;
}
.item img {
  width: 60px;
  height: 55px;
  border-radius: 5px;
}
.right {
  flex: 1;
}
.time {
  margin-top: 16px;
}
</style>
